<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .img {
            position: relative;
            width: 200px;
            height: 200px;
            margin: 50px auto;
            -webkit-transform: rotate(45deg);
            -moz-transform: rotate(45deg);
            -o-transform: rotate(45deg);
            transform: rotate(45deg);
            border-radius: 10px;
            overflow: hidden;
        }
        .img img {
            position: absolute;
            left: 50%;
            top: 50%;
            display: block;
            width: 300px;
            height: 300px;
            margin-top: -150px;
            margin-left: -150px;
            -webkit-transform: rotate(-45deg);
            -moz-transform: rotate(-45deg);
            -o-transform: rotate(-45deg);
            transform: rotate(-45deg);
        }
    </style>
</head>
<body>
    <div class="img" id="img">
        <img src="https://picsum.photos/300/300" alt="" id="pic">
    </div>
    
    <button id="show">显示多余内容</button>
    <button id="hide">隐藏多余内容</button>
    
    <script>
            document.getElementById('show').onclick = function () {
                document.getElementById('img').style.border = '1px solid #f00';
                document.getElementById('img').style.overflow = 'visible';
                document.getElementById('pic').style.border = '1px solid #f00';
                document.getElementById('pic').style.opacity = '.5';
            }
            document.getElementById('hide').onclick = function () {
                document.getElementById('img').style.border = '0';
                document.getElementById('img').style.overflow = 'hidden';
                document.getElementById('pic').style.border = '0';
                document.getElementById('pic').style.opacity = '1';
            }
    
        </script>
</body>
</html>